function login() {
    let frameWork = document.getElementsByTagName("div")[0];
    frameWork.style.height=document.documentElement.clientHeight+"px";
    frameWork.style.textAlign="center";
    configImg();
}
function rest() {
    window.location.href="/index.html"
}
function configImg() {
    axios.get('http://localhost:8080/refreshJson', {
        params: {
            open: 1
        }
    })
        .then(function (response) {
            document.body.style.backgroundImage="url("+ response.data +")"
        })
        .catch(function (error) {
            console.log(error);
        });
}
function submitLoginAction() {
    axios({
        headers: {'Content-Type':'application/x-www-form-urlencoded'},
        method: "post",
        url: "http://localhost:8080/submitLogin",
        params: { username:document.getElementById("username").value, password:document.getElementById("password").value},
}).then(function (response) {
        if(!response.data.success){
            alert(response.data.error);
            window.location.href="http://localhost:8080/loginAction";
        }else {
            alert(response.data.message);
            window.location.href="http://localhost:8080/admin";
        }
})
}
